<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>文章列表</title>
</head>
<body>
<div style="color: #4e86fe">
    {% for message in messages %}
        <div> {{ message }}</div>
    {% endfor %}
</div>
<form>
    <input type="search" name="q" value="{{ request.GET.q }}">
    <input type="submit" ,value="搜索">
</form>
<a href='{% url 'article:add' %}'>添加+</a>
<table>
    <tr>
        <td> 标题</td>
        <td> 作者</td>
        <td> 操作</td>
    </tr>
    {% for article in articles %}
        <tr>
            <td>
                {{ article.title }}
            </td>
            <td>
                {{ article.author }}
            </td>
            <td>
                <a href="{% url 'article:edit' article.pk %}">编辑</a>
                <a href="{% url 'article:delete' article.pk %}">删除</a>

            </td>
        </tr>
    {% endfor %}

</table>
<nav>

    {% if articles.has_previous %}
        <a href="?page={{ articles.previous_page_number }}&q={{ request.GET.q }}">上一页</a>
    {% endif %}
    <strong>{{ articles.number }}</strong>
    {% if articles.has_next %}
        <a href="?page={{ articles.next_page_number }}&q={{ request.GET.q }}">下一页</a>
    {% endif %}

</nav>

</body>
</html>